|
hbridge18 2.2.1
|
API for configuring and manipulating H-Bridge 18 Click driver. More...
Topics | |
| H-Bridge 18 Registers List | |
| List of registers of H-Bridge 18 Click driver. | |
| H-Bridge 18 Registers Settings | |
| Settings for registers of H-Bridge 18 Click driver. | |
| H-Bridge 18 MikroBUS Map | |
| MikroBUS pin mapping of H-Bridge 18 Click driver. | |
Functions | |
| void | hbridge18_cfg_setup (hbridge18_cfg_t *cfg) |
| H-Bridge 18 configuration object setup function. | |
| err_t | hbridge18_init (hbridge18_t *ctx, hbridge18_cfg_t *cfg) |
| H-Bridge 18 initialization function. | |
| err_t | hbridge18_default_cfg (hbridge18_t *ctx) |
| H-Bridge 18 default configuration function. | |
| err_t | hbridge18_write_reg (hbridge18_t *ctx, uint8_t reg, uint8_t data_in) |
| H-Bridge 18 write register function. | |
| err_t | hbridge18_read_reg (hbridge18_t *ctx, uint8_t reg, uint8_t *data_out) |
| H-Bridge 18 read register function. | |
| void | hbridge18_enable_device (hbridge18_t *ctx) |
| H-Bridge 18 enable device function. | |
| void | hbridge18_disable_device (hbridge18_t *ctx) |
| H-Bridge 18 disable device function. | |
| uint8_t | hbridge18_get_fault_pin (hbridge18_t *ctx) |
| H-Bridge 18 get fault pin function. | |
| err_t | hbridge18_check_communication (hbridge18_t *ctx) |
| H-Bridge 18 check communication function. | |
| err_t | hbridge18_set_motor_state (hbridge18_t *ctx, uint8_t motor, uint8_t state) |
| H-Bridge 18 set motor state function. | |
API for configuring and manipulating H-Bridge 18 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void hbridge18_cfg_setup | ( | hbridge18_cfg_t * | cfg | ) |
H-Bridge 18 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See hbridge18_cfg_t object definition for detailed explanation. |
| err_t hbridge18_check_communication | ( | hbridge18_t * | ctx | ) |
H-Bridge 18 check communication function.
This function checks communication with the device by reading and verifying the configuration register.
| [in] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
0 - Success (Device ID matches), -1 - Error (Device ID mismatch or communication failure). | err_t hbridge18_default_cfg | ( | hbridge18_t * | ctx | ) |
H-Bridge 18 default configuration function.
This function executes a default configuration of H-Bridge 18 Click board.
| [in] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void hbridge18_disable_device | ( | hbridge18_t * | ctx | ) |
H-Bridge 18 disable device function.
This function disables the H-Bridge 18 device by setting the sleep pin low.
| [in] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
| void hbridge18_enable_device | ( | hbridge18_t * | ctx | ) |
H-Bridge 18 enable device function.
This function enables the H-Bridge 18 device by setting the sleep pin high.
| [in] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
| uint8_t hbridge18_get_fault_pin | ( | hbridge18_t * | ctx | ) |
H-Bridge 18 get fault pin function.
This function reads the fault pin logic state.
| [in] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
| err_t hbridge18_init | ( | hbridge18_t * | ctx, |
| hbridge18_cfg_t * | cfg ) |
H-Bridge 18 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See hbridge18_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t hbridge18_read_reg | ( | hbridge18_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
H-Bridge 18 read register function.
This function reads a byte of data from the specified register using the SPI interface.
| [in] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Pointer to store the read data. |
0 - Success, -1 - Error. | err_t hbridge18_set_motor_state | ( | hbridge18_t * | ctx, |
| uint8_t | motor, | ||
| uint8_t | state ) |
H-Bridge 18 set motor state function.
This function sets the motor state for the selected motor (coast, forward, reverse, brake low-side, or brake high-side).
| [in] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
| [in] | motor | : Motor selection.
|
| [in] | state | : Motor state selection.
|
0 - Success, -1 - Error. | err_t hbridge18_write_reg | ( | hbridge18_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
H-Bridge 18 write register function.
This function writes a byte of data to the specified register using the SPI interface.
| [in] | ctx | : Click context object. See hbridge18_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data to be written to the register. |
0 - Success, -1 - Error.